package example01.factory;

import com.sun.xml.internal.bind.AccessorFactory;
import com.sun.xml.internal.bind.v2.runtime.reflect.Accessor;
import example01.human.Human;

import javax.xml.bind.JAXBException;
import java.lang.reflect.Field;
import java.lang.reflect.Method;

/**
 * @Author 幻忧
 * @Date 2020/12/13 18:43
 * @Version 1.0
 * @Description TODO
 */
public class HumanFactory extends AbstractHumanFactory {
    @Override
    public <T extends Human> T createHuman(Class<T> c) {
        //定义一个生产的人种
        Human human = null;
        try {
            //产生一个人种
            human = (T) Class.forName(c.getName()).newInstance();
        } catch (Exception e) {
            System.out.println("人种生成错误！");
        }
        return (T) human;
    }
}
